<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Str;

class FmwJDController extends Controller
{
    protected $baseUrl = '/api/jd/';

    protected $requestParams = [];

    protected $oaid = '';

    protected $desenMobile = '';

    protected $orderId = '202505190001';

    // WAIT_SELLER_STOCK_OUT;WAIT_GOODS_RECEIVE_CONFIRM;FINISHED_L;TRADE_CANCELED;LOCKED
    protected $orderStatus = 'WAIT_SELLER_STOCK_OUT';

    public function index(Request $request)
    {
        $method = $request->get('method');
        if (!empty($method)) {
            $method = str_replace('.', '_', $method);
        } else {
            $url = $request->get('s');
            $methodUrl = str_replace($this->baseUrl, '', $url);
            if (!empty($methodUrl)) {
                $method = str_replace('/', '_', $methodUrl);
            } else {
                return [];
            }
        }

        if (!method_exists($this, $method)) {
            echo sprintf("[%s] mock function not exists", $method);
            exit;
        }
        $this->requestParams = json_decode($request->get('360buy_param_json'), true);

        $this->oaid = sprintf('OAID****%s****OAID', Str::random(256 - 16));
        $this->desenMobile = sprintf('%s****%s', Str::random(10), Str::random(10));

        return $this->$method($request);
    }

    // 京配检查
    public function jingdong_etms_range_check(Request $request)
    {
        $resultInfo = [
            "destinationCrossCode" => "1",
            "originalTabletrolleyCode" => "720-8R",
            "destinationTabletrolleyCode" => "420-兰-H",
            "rmessage" => "可以京配",
            "orderId" => $this->requestParams['orderId'],
            "sourcetSortCenterId" => "820864",
            "targetSortCenterId" => "58176",
            "siteName" => "◆兰州兰工坪营业部",
            "rcode" => "100",
            "promiseTimeType" => "1",
            "preSortCode" => "20",
            "isHideContractNumbers" => "1",
            "isHideName" => "1",
            "promiseTimeTypeDownGrade" => "false",
            "sourcetSortCenterName" => "东莞亚一分拣中心",
            "transType" => "0",
            "road" => "17",
            "siteId" => rand(100000, 999999),
            "aging" => "0",
            "originalCrossCode" => "99E",
            "targetSortCenterName" => "兰州分拨中心",
            "agingName" => "无时效",
            "expressOperationMode" => "1"
        ];

        $response = [
            "jingdong_etms_range_check_responce" => [
                "resultInfo" => $resultInfo
            ],
        ];

        return $response;
    }

    // (青龙)获取运单号
    public function jingdong_etms_waybillcode_get(Request $request)
    {
        $deliveryIdList = [];
        for ($i = 0; $i < $this->requestParams['preNum']; $i++) {
            $deliveryIdList[] = sprintf('XCXD_JD__QL_%s', date('YmdHis', time()));
        }

        $response = [
            "jingdong_etms_waybillcode_get_responce" => [
                "resultInfo" => [
                    "deliveryIdList" => $deliveryIdList,
                    "code" => "100",
                    "message" => "成功"
                ]
            ],
        ];

        return $response;
    }

    // (青龙)物流下单
    public function jingdong_etms_waybill_send(Request $request)
    {
        $response = [
            "jingdong_etms_waybill_send_responce" => [
                "resultInfo" => [
                    "deliveryId" => $this->requestParams['deliveryId'],
                    "code" => "100",
                    "orderId" => $this->requestParams['orderId'],
                    "message" => "成功"
                ]
            ],
        ];

        return $response;
    }

    // (无界)物流下单
    public function jingdong_ldop_alpha_waybill_receive(Request $request)
    {
        $content = json_decode($this->requestParams['content'], true);

        $waybillCodes = [];
        $waybillCount = $content['waybillCount'];
        for ($i = 0; $i < $waybillCount; $i++) {
            $waybillCodes[] = sprintf('XCXD_JD__WJ_%s', date('YmdHis') . rand(1000, 9999));
        }

        $response = [
            "data" => [
                "platformOrderNo" => $content['platformOrderNo'],
                "waybillCodeList" => $waybillCodes
            ],
            "statusMessage" => "调用成功",
            "statusCode" => 0
        ];

        return $response;
    }

    // (无界)大头笔查询
    public function jingdong_ldop_alpha_vendor_bigshot_query(Request $request)
    {
        $resultInfo = [
            "data" => [
                "fromBranchName" => "7上海嘉定区南翔金地服务部",
                "secondSectionCode" => "F056-00",
                "bigShotName" => "300C",
                "bigShotCode" => "300C",
                "toBranchName" => "上海普陀区曹杨公司",
                "gatherCenterName" => "上海-同城",
                "waybillCode" => $this->requestParams['waybillCode'],
                "gatherCenterCode" => "J999246",
                "thirdSectionCode" => "B4-AC"
            ],
            "statusMessage" => "大头笔信息查询成功",
            "statusCode" => 0
        ];

        $response = [
            "jingdong_ldop_alpha_vendor_bigshot_query_responce" => [
                "code" => "0",
                "resultInfo" => $resultInfo
            ]
        ];

        return $response;
    }

    // 打印物流单
    public function pullData(Request $request)
    {
        $params = $request->get(0);
        $prePrintDatas = [];

        $objectId = $params['objectId'];
        $wayBillInfos = $params['wayBillInfos'];

        foreach ($wayBillInfos as $info) {
            $prePrintDatas[] = [
                "code" => "1",
                "msg" => "操作成功！",
                "perPrintData" => "QMNwNAcT/A5KUESRgH4ETWWNmPq1RKNyoOo2cy8c6oWelxUmErq7vER8mRZhkYgEl355N0nBoFFtYo3EEU7hnJzsHORWXe87dLzxl/0V7xXZHltGb9lOQpxOTz9mYCVIVjFNT+IClTMAw1a1trs06ZQQHGhMF8zEwrlH7/PaBf+RDYlHfdnnAF2a63mr2UyS8GX792mqIwvlGeRBqbnzp2gx7lJQGdMeVO1sdXSU9oddEDYUtz28EGfTv0qu24kjEXKuRMTrHzthDtRA9wTNMFk6qC/7Z25ea3rBvxWJq7OyvIoxb9pTrI5+nsIBIRAGrDRaosmPms4VcjMYhbYiprVRCFPeZdJ2p5zvWgyH0fN0eUMhuPDMVwuOIkHVSag0xxE8CxZrcHIcLZ4p5LRIRuINCDpnzgOwmrMABZNu1AOicwNx/Fc7F/mW/1M7fbbTyOnmaQyUM9yA8LwXErd8/YhOc56GGVBkku+r7/6vGNKSBHRbINTINjX/gu2SiQcy70BElzlDjicKfrq8FClq4WFPjwE59kCXg5hNOB8s34iinAnjAlP5OC9YWcdh6Kg20+Wr09sGFVOFnLUOISPUrPWDOlPnIZEk6OTOh4dFXDdPAJjFTqmr7Yc4S1Loo91OyXPl+234yNR2KGhHBzCHFsTdgHlGfGhloahUnCaSu0nIU5M3GZUjhwyEO5ae+bJEQ/Rww/MrNnNlrkR16P8bFQCVu3Pln1lqnHCqJ5ES5CtFOv5XHWFmWJUltt5bguX/R+/4uNdgZQ950uUuSZBwe4UnXKsc78VdsbvHzYSVbrkueBJzwNexmkX3bGuC1t8FMfrRnymsJB0UDicE85+IHswi9WjqUflo6XRr1rx++fojuZnP9UZi5I9+6I4MuPG0BEyrqxyCOa+Y7w3FfcWmgz1oF72sTvG9eBbV7GutC8J6iDUDcAKeuQIyxlSswJsVJU6bBAEfs7G69LfDw3Y7/xhDqc4eK+V6HeGdSJ7caA/NR+KiLvqRgJPWlCkqIT4jKAoRJihpT+qO9pm3d4ZrJwu4K2clIpd6pbgrIfNg8fds85GzsmQHQqrNQ3+Cx+/WWrd+qrRPJb+32D785qn74zLKrMIodcpX8rmlONk5e51nGu2GsBVm+Z/eOfKlLxM04l977RkJjtvUA713eGRs3LPcrDrlyEAISewP4CF4tPPRDwiyI7g2OgiFccToIBzQR8tNcAblRsXy8HWubjrmTk+vA8W2C4kbj12GYOesYqhxjn9VSJTAvKNERZRwO6xODKa8QVZOPhOXAns+rCbZR8TRSf7YuSmLHQZoHm0MKOPtKqPH3LFrsDGhAo6JOKMc",
                "wayBillNo" => isset($info['wayBillCode']) ? $info['wayBillCode'] : $info['jdWayBillCode']
            ];
        }

        $response = [
            "code" => "1",
            "message" => "操作成功！",
            "objectId" => $objectId,
            "prePrintDatas" => $prePrintDatas
        ];

        return $response;
    }

    public function jingdong_pop_afs_soa_compensate_queryCompensateList(Request $request)
    {
        $result = [
            "compensateamount" => 10,
            "compensate_reason" => "商家直赔",
            "shouldpay" => 0,
            "created" => 1676444610291,
            "type" => 20,
            "check_status" => 0,
            "compensate_keyid" => 189868793 . rand(000, 999),
            "vender_id" => 20240823,
            "can_second_appeal" => 0,
            "erp_check_status" => 0,
            "modified" => 1676444620398,
            "compensate_id" => 187241334 . rand(000, 999),
            "order_id" => 260889668961,
            "order_type" => 22,
            "compensate_type" => 20
        ];

        return [
            "jingdong_pop_afs_soa_compensate_queryCompensateList_responce" => [
                "code" => "0",
                "queryResult" => [
                    "success" => true,
                    "errorCode" => "10000",
                    "errorMsg" => "查询成功!",
                    "result" => [$result],
                ],
            ],
        ];
    }

    // 根据 code 获取 access_token
    public function oauth_token(Request $request)
    {
        return [
            "access_token" => "a3207b6b5ad04249ad1dbf6a98248bea",
            "expires_in" => 3600000,
            "refresh_token" => "4ecbbab0e9e443159c518da1d10741ad",
            "scope" => "snsapi_base",
            "open_id" => "jos_dev"
        ];
    }

    // 根据 refresh_token 刷新 access_token
    public function oauth_refresh_token(Request $request)
    {
        return [
            "access_token" => "NEW_a3207b6b5ad04249ad1dbf6a98248bea",
            "expires_in" => 3600000,
            "refresh_token" => "NEW_4ecbbab0e9e443159c518da1d10741ad",
            "scope" => "snsapi_base",
            "open_id" => "jos_dev"
        ];
    }


    public function jingdong_pop_afs_soa_refundapply_queryPageList()
    {
        // 退款申请单状态
        //  0、未审核 1、商家审核通过2、审核不通过 3、京东财务审核通过 4、京东财务审核不通过 6、拦截并退款
        //  7、青龙拦截成功 8、青龙拦截失败 9、强制关单并退款 10、物流待跟进 11、用户撤销
        $skuVoList = [
            "skuName" => "测试商品",
            "skuUuid" => "2025_F1Z2w3v143194525SKUA00002",
            "skuId" => 123456789,
            "skuCount" => "1"
        ];

        $status = 1;
        $refund = [
            "reason" => "用户买错",
            "skuVoList" => [$skuVoList],
            "systemId" => 10,
            "orderId" => $this->orderId,
            "partRefundType" => 1, // 1、部分退 0、全部退
            "buyerId" => "aa",
            "buyerName" => "aa",
            "storeId" => "0",
            "applyRefundSum" => 1.11,
            "checkRemark" => "审核通过",
            "checkTime" => date('Y-m-d H:i:s'),
            "checkUserName" => "aaa",
            "id" => time(),
            "applyTime" => date('Y-m-d H:i:s'),
            "open_id_buyer" => "aa",
            "status" => $status
        ];

        return [
            'jingdong_pop_afs_soa_refundapply_queryPageList_responce' => [
                'queryResult' => [
                    "result" => [
                        $refund
                    ],
                    "success" => true,
                    "errorCode" => 10000,
                    "totalCount" => 0,
                    "errorMsg" => "查询成功!"
                ],
            ],
        ];
    }

    public function jingdong_pop_order_get(Request $request)
    {
        $itemInfo = [
            "skuName" => "测试商品名称",
            "itemTotal" => 3,
            "wareId" => 89112,
            "outerSkuId" => "SKUA00001",
            "jdPrice" => 2580.00,
            "serviceName" => "服务项名称",
            "itemExt" => json_encode([
                'skuUuid' => '1012_F1Z2w3v1431945255722668032'
            ]),
            "giftPoint" => 1000,
            "skuId" => 10096163286259,
            "productNo" => "891112345",
            "newStoreId" => 1
        ];

        $itemInfo2 = $itemInfo;
        $itemInfo2['skuId'] = 123456789;
        $itemInfo2['outerSkuId'] = 'SKUA00002';
        $itemInfo2['jdPrice'] = 10;
        $itemInfo2['itemExt'] = json_encode([
            'skuUuid' => '2025_F1Z2w3v143194525SKUA00002'
        ]);

        $consigneeInfo = [
            "town" => "xxx镇",
            "city" => "运城市",
            "mobile" => "133*******1",
            "county" => "闻喜县",
            "telephone" => "010*******1",
            "cityId" => 274,
            "townId" => 49968,
            "provinceId" => 5,
            "province" => "山西省",
            "countyId" => 49707,
            "fullAddress" => "山西省运城市闻喜县xx镇xxxx",
            "fullname" => "张**",
            "desen_telephone" => "010*******1",
            "oaid" => $this->oaid,
            "desen_mobile" => $this->desenMobile,
        ];

        $couponDetail = [
            "orderId" => 91379271133,
            "couponType" => 29,
            "couponPrice" => 1,
            "skuId" => 1233321
        ];

//        $paymentDetailList = '[{"amountExpands":[{"amount":15,"orderCostAmounts":[{"bearAmount":15,"bearRate":1,"bearer":2}],"type":4,"typeName":"店铺东券"},{"amount":5,"orderCostAmounts":[{"bearAmount":5,"bearRate":1,"bearer":1}],"type":2,"typeName":"东券"},{"amount":388,"orderCostAmounts":[{"bearAmount":388,"bearRate":1,"bearer":1}],"type":112,"typeName":"在线支付"}],"num":1,"orderId":301516990001,"skuId":10113794430787,"skuType":4,"skuUuid":"1012_F1Z2w3v1431945255722668032"}]';
//        $paymentDetailList = '[{"amountExpands":[],"moneyOfSuit":0,"num":1,"orderId":202510200001,"skuId":10186197322806,"skuType":3,"skuUuid":"1012_Sd1HJ2T1542968159222018048G10186197322806"},{"amountExpands":[],"moneyOfSuit":0,"num":1,"orderId":202510200001,"skuId":10186197322802,"skuType":3,"skuUuid":"1012_Sd1HJ2T1542968159222018048G10186197322802"},{"amountExpands":[{"amount":10,"orderCostAmounts":[{"bearAmount":10,"bearRate":1,"bearer":2}],"type":11,"typeName":"自营商家联合优惠券"},{"amount":396.6,"orderCostAmounts":[{"bearAmount":396.6,"bearRate":1,"bearer":2}],"type":11,"typeName":"自营商家联合优惠券"},{"amount":225,"orderCostAmounts":[{"bearAmount":225,"bearRate":1,"bearer":2}],"type":37,"typeName":"折上折补贴"},{"amount":0.11,"orderCostAmounts":[{"bearAmount":0.11,"bearRate":1,"bearer":1}],"type":151,"typeName":"超级红包"},{"amount":15.7,"orderCostAmounts":[{"bearAmount":15.7,"bearRate":1,"bearer":1}],"type":101,"typeName":"礼品卡"},{"amount":15.56,"orderCostAmounts":[{"bearAmount":15.56,"bearRate":1,"bearer":1}],"type":126,"typeName":"支付营销优惠类型"},{"amount":3303.03,"orderCostAmounts":[{"bearAmount":3303.03,"bearRate":1,"bearer":1}],"type":112,"typeName":"在线支付"}],"moneyOfSuit":0,"num":1,"orderId":202510200001,"skuId":10166201922907,"skuType":4,"skuUuid":"1012_d1HJ2T1542968159222018048"}]';
        $paymentDetailList = '[{"amountExpands":[],"moneyOfSuit":0,"num":1,"orderId":202510200001,"skuId":10087895331402,"skuType":3,"skuUuid":"1012_SF2t2t3A1545507710596112384G10087895331402"},{"amountExpands":[{"amount":481,"orderCostAmounts":[{"bearAmount":481,"bearRate":1,"bearer":2}],"type":215,"typeName":"京享礼金"},{"amount":0.35,"orderCostAmounts":[{"bearAmount":0.35,"bearRate":1,"bearer":1}],"type":151,"typeName":"超级红包"},{"amount":2098.65,"orderCostAmounts":[{"bearAmount":2098.65,"bearRate":1,"bearer":1}],"type":112,"typeName":"在线支付"}],"moneyOfSuit":0,"num":1,"orderId":202510200001,"skuId":10096163286259,"skuType":4,"skuUuid":"1012_F2t2t3A1545507710596112384"}]';
//        $paymentDetailList = '';

        $orderInfo = [
            "orderSellerPrice" => 80,
            "orderType" => 22,
            "logisticsId" => 21,
            "orderSign" => "sendpay(京东内部标识业务类型的字符串，一般为500位)",
            "orderId" => $this->requestParams['order_id'],
            "paymentConfirmTime" => date('Y-m-d H:i:s'),
            "orderStateRemark" => "买家已经付款",
            "orderState" => $this->orderStatus,
            "payType" => '4',
            "itemInfoList" => [$itemInfo, $itemInfo2],
            "paymentDetailList" => $paymentDetailList, // 支付项拆分分摊明细  string
            "pin" => "hys7975",
            "waybill" => "运单号(当厂家自送时运单号可为空，不同物流公司的运单号用|分隔，如果同一物流公司有多个运单号，则用英文逗号分隔) 可选字段，需要在输入参数optional_fields中写入才能返回",
            "customs" => "广州南沙保税区",
            "modified" => date('Y-m-d H:i:s'),
            "promisePickDate" => date('Y-m-d H:i:s', strtotime('+7 day')), // 承诺最晚揽件时间
            "salesPin" => "jd_51b90fbbf3118",
            "freightPrice" => 10,
            "tuiHuoWuYou" => 0.0,
            "balanceUsed" => 0.0,
            "serviceFee" => 1,
            "directParentOrderId" => 457612313001,
            "originalConsigneeInfo" => $consigneeInfo,
            "orderTotalPrice" => 3966.00,
            "invoiceCode" => "普通发票纳税人识别码",
            "mdbStoreId" => 23900,
            "idSopShipmenttype" => 68,
            "sellerDiscount" => 20,
            "customsModel" => "直邮",
            "venderRemark" => "可发货",
            "couponDetailList" => [$couponDetail],
            "menDianId" => 32,
            "sendpayMap" => "{“301”：“1,“501”：“1”,“509”:“1”,”688”:”2”,“559”:“2”,“599”:”7”}",
            "venderId" => 177187,
            "orderRemark" => "尽快发货",
            "orderMarkDesc" => [
                "TryBeforePayLater" => 1
            ],
            "scDT" => date('Y-m-d H:i:s', strtotime('-1 hour')),
            "parentOrderId" => 457612313,
            "orderEndTime" => date('Y-m-d H:i:s', strtotime('-1 hour')),
            "taxFee" => 100,
            "vatInfo" => [
                "bankAccount" => "银行账号",
                "userAddress" => "北京市大兴区科创十一街",
                "depositBank" => "中国人民银行",
                "vatNo" => "1",
                "addressRegIstered" => "北京市海淀区",
                "userPhone" => "18312333333",
                "invoicePersonalName" => "李四",
                "userName" => "张三",
                "phoneRegIstered" => "15034342222"
            ],
            "open_id_buyer" => "hys7975",
            "open_id_seller" => "jd_51b90fbbf3118",
            "invoiceInfo" => "发票信息。电子发票请从invoiceEasyInfo里取 “invoice_info: 不需要开具发票”下无需开具发票；其它返回值请正常开具发票",
            "orderSource" => "移动端订单",
            "orderExt" => '{}',
            "deliveryType" => "只工作日送货(双休日、假日不用送)",
            "pauseBizInfo" => [
                'pauseBizDataYy' => [
                    "dbDT" => date('Y-m-d H:i:s', strtotime('-1 hour')),
                    "ljDT" => date('Y-m-d H:i:s', strtotime('-1 hour')),
                    "codDT" => date('Y-m-d H:i:s', strtotime('-1 hour'))
                ],
                'pauseBizStatusList' => [
                    [
                        "bizType" => "1",
                        "bizStatus" => "1"
                    ]
                ],
            ],
            "storeId" => 0,
            "orderPayment" => 57.22,
            "consigneeInfo" => $consigneeInfo,
            "returnOrder" => 0,
            "invoiceEasyInfo" => [
                "invoiceConsigneeEmail" => "电子发票联系人邮箱",
                "invoiceConsigneePhone" => "13222222222",
                "invoiceType" => 3,
                "invoiceContentId" => "发票内容",
                "invoiceTitle" => "发票抬头",
                "invoiceCode" => "1WEUO2384329SD"
            ],
            "storeOrder" => "京仓订单",
            "realPin" => "hyS7975",
            "orderStartTime" => date('Y-m-d H:i:s', strtotime('-1 hour'))
        ];

        return [
            'jingdong_pop_order_get_responce' => [
                'orderDetailInfo' => [
                    'apiResult' => [
                        "englishErrCode" => "system exception",
                        "success" => true,
                        "chineseErrCode" => "系统异常",
                        "numberCode" => 10000
                    ],
                    'orderInfo' => $orderInfo,
                ],
            ],
        ];
    }

    public function jingdong_pop_order_search(Request $request)
    {
        $itemInfo = [
            "skuName" => "测试商品名称",
            "itemTotal" => 2,
            "wareId" => 89112,
            "outerSkuId" => "SKUA00001",
            "jdPrice" => 100,
            "serviceName" => "服务项名称",
            "itemExt" => "",
            "giftPoint" => 50,
            "skuId" => 12389871,
            "productNo" => "891112345",
            "newStoreId" => 21
        ];

        $consigneeInfo = [
            "town" => "齐心庄镇",
            "city" => "廊坊市",
            "mobile" => "133*******1",
            "county" => "三河市",
            "telephone" => "010*******1",
            "cityId" => "274",
            "townId" => "49968",
            "provinceId" => "5",
            "province" => "河北省",
            "countyId" => "49707",
            "fullAddress" => "北京市海淀区******",
            "fullname" => "张**",
            "desen_telephone" => "010*******1",
            "oaid" => $this->oaid,
            "desen_mobile" => $this->desenMobile,
        ];

        $orders = [
            [
                "orderSellerPrice" => "100",
                "orderType" => "22",
                "logisticsId" => "21",
                "orderSign" => "100112200100001220",
                "orderId" => sprintf('%s%s', date('YmdHis'), rand(0000, 9999)),
                "paymentConfirmTime" => date('Y-m-d H:i:s'),
                "partialLogisticsInfoModel" => [],
                "orderStateRemark" => "等待出库",
                "orderState" => $this->orderStatus,
                "payType" => "1",
                "itemInfoList" => [$itemInfo],
                "pin" => "testpin",
                "waybill" => "VL21309123",
                "customs" => "如广州南沙保税区、北京保税区等",
                "modified" => date('Y-m-d H:i:s'),
                "salesPin" => "testpin01",
                "freightPrice" => 0,
                "tuiHuoWuYou" => 0,
                "balanceUsed" => 0,
                "serviceFee" => 0,
                "directParentOrderId" => "457612313",
                "originalConsigneeInfo" => $consigneeInfo,
                "orderTotalPrice" => "20.00",
                "invoiceCode" => "FPSBM943222",
                "mdbStoreId" => "121",
                "idSopShipmenttype" => "68",
                "sellerDiscount" => "20",
                "ctpOrderInfo" => [
                    "ctpName" => "张三（加密）",
                    "ctpParentOrderId" => "12345678",
                    "ctpOrderId" => "123456",
                    "ctpWhere" => "北京亦庄经济技术开发区科创十一街18号院(加密)",
                    "ctpShopId" => "12345",
                    "ctpMobile" => "12345678（加密）"
                ],
                "customsModel" => "直邮，保税集货，保税备货",
                "venderRemark" => "会尽快发货(请去备注接口获取)",
                "couponDetailList" => [],
                "menDianId" => "21",
                "sendpayMap" => "{“301”：“1”，“501”：“1”，“509”:“1”,”688”:”2”,“559”:“2”，“599”:”7”}",
                "venderId" => "281201",
                "orderRemark" => "尽快发货",
                "popSignMap" => "",
                "orderMarkDesc" => [],
                "scDT" => date('Y-m-d H:i:s', strtotime('-1 hour')),
                "parentOrderId" => "457612313",
                "orderEndTime" => date('Y-m-d H:i:s', strtotime('-1 hour')),
                "taxFee" => "100",
                "vatInfo" => [
                    "bankAccount" => "北京市招商银行大兴分行",
                    "userAddress" => "北京市海淀区******",
                    "depositBank" => "北京市银行",
                    "vatNo" => "VL23213109",
                    "addressRegIstered" => "北京市大兴区XX",
                    "userPhone" => "133*******1",
                    "invoicePersonalName" => "李四",
                    "userName" => "张**",
                    "phoneRegIstered" => "18311111111",
                    "desen_userPhone" => "133*******1"
                ],
                "open_id_buyer" => "testpin",
                "open_id_seller" => "testpin01",
                "invoiceInfo" => "1",
                "orderSource" => "拍拍订单",
                "orderExt" => '{}',
                "deliveryType" => "1",
                "pauseBizInfo" => [],
                "storeId" => 0,
                "orderPayment" => 200,
                "consigneeInfo" => $consigneeInfo,
                "returnOrder" => "0",
                "invoiceEasyInfo" => [
                    "invoiceConsigneeEmail" => "111@jd.com",
                    "invoiceConsigneePhone" => "133*******1",
                    "invoiceType" => "0",
                    "invoiceContentId" => "21",
                    "invoiceTitle" => "无需发票",
                    "invoiceCode" => "VLN2131312321"
                ],
                "storeOrder" => "京仓订单",
                "realPin" => "testPin",
                "orderStartTime" => date('Y-m-d H:i:s', strtotime('-1 hour'))
            ],
        ];

        return [
            'jingdong_pop_order_search_responce' => [
                'searchorderinfo_result' => [
                    "apiResult" => [],
                    "orderInfoList" => $orders,
                    "orderTotal" => $this->requestParams['page'] > 1 ? 0 : count($orders)
                ],
            ],
        ];
    }

    public function jingdong_pop_order_coupondetail(Request $request)
    {
        return [
            'jingdong_pop_order_coupondetail_responce' => [
                'couponDetailExternal' => [
                    'couponDetailVo' => [
                        "totalPlus95" => 0.0,
                    ]
                ],
            ],
        ];
    }

    public function jingdong_vender_shop_query(Request $request)
    {
//        return [
//            'error_response' => [
//                'code' => 19,
//                'zh_desc' => '无效access_token',
//                'en_desc' => 'Invalid access_token'
//            ]
//        ];
        return [
            "jingdong_vender_shop_query_responce" => [
                "shop_jos_result" => [
                    "vender_id" => "20240823",
                    "shop_name" => "测试jd店铺",
                    "shop_id" => "123",
                    "brief" => "店铺简介",
                    "logo_url" => "logo地址",
                    "category_main" => "000",
                    "category_main_name" => "主营类目名称",
                    "open_time" => "2024-02-22 15:13:00",
                ]
            ]
        ];
    }

    //  解码 OAID 返回收件人信息
    public function jingdong_jos_order_oaid_decrypt(Request $request)
    {
        $data = [];
        $orderInfos = $this->requestParams['getReceiverInfoListReqVO']['orderInfos'] ?? [];
        foreach ($orderInfos as $orderInfo) {
            $data[] = [
                "customerPhone" => "AAQj+3uOVj86RhQ3tkZBacZagajkGZFfClMz3T+XB7SPkQzetIo94szOAJOTmZyJ82xdkrTBDCxivyD",
                "address" => "AAQj+3uOVj86RhQ3tkZBacZaiiOVpEP8nWHImxvdNBFiwpDFiZ1SxDtuuuAqxQEM+7i6NC1Nr8bcyzI5P4YyOwW0d6Xj4ZhpifM1xX6ppudV1EDaIIEG8+7u9X1LnZrg2CHhekK65irLlqxgtzo5nSR5CE1VY3S+439/VYuQlxP27w7el3dq96SaBKyQI8S6RefmCw42/8EO3ZprNnOXLA==",
                "privacyProtection" => "true",
                "orderId" => $orderInfo['orderId'],
                "consMobilePhone" => "AAQj+3uOVj86RhQ3tkZBacZagajkGZFfClMz3T+XB7SPkQzetIo94szOAJOTmZyJ82xdkrTBDCxivyD",
                "expiration" => date('Y-m-d H:i:s'),
                "consMobilePhoneFuzzy" => "AAQj+3uOVj86RhQ3tkZBacZawpvlHJwA5Ym7yQoHSGtpVArq7bT8EjD9Y=",
                "oaid" => $orderInfo['oaid'],
                "customerName" => "AAQj+3uOVj86RhQ3tkZBacZalif2J4gJ11NqudsD9cavc+ZE/+n5tOmXt3eUtYJgAK+inrqzcIr50Yu4WpOwfn6G0aYNlWtCuXJEp4YO5fMiQ3Fh9xGOVAHQ="
            ];
        }

        $code = 200;
        $message = 'success';

        // 解密失败
//        $code = 406;
//        $data = [];
//        $message = 'appKey：3E43376ECD473CEE315D73C2ABC778CA venderId：667324 请商家使用京东快递、无界面单发货，京东打印插件打印面单。如需明文，请使用虚拟号（虚拟号支持拨打11位明文转4位分机号联系客户和个别快递柜投递场景，请商家根据业务场景谨慎使用）';

//        return Response('解密失败！', 400);

        return [
            'jingdong_jos_order_oaid_decrypt_responce' => [
                'returnType' => [
                    "code" => $code,
                    "data" => $data,
                    "requestId" => "12312321",
                    "message" => $message
                ],
            ],
        ];
    }

    public function jingdong_presale_order_updateOrder_getPresaleOrderByPage(Request $request)
    {
        return [
            'jingdong_presale_order_updateOrder_getPresaleOrderByPage_responce' => [
                'returnType' => [
                    "code" => "200",
                    "data" => [
                        [
                            "orderType" => "22",
                            "orderId" => "1000323232",
                            "freight" => "0",
                            "orderStatus" => 0,
                            "orderPayType" => "0",
                            "yushouPrice" => "0",
                            "payBargainPlan" => "0",
                            "productName" => "商品名",
                            "companyid" => "1",
                            "orderTime" => "2021-04-22 10:11:00",
                            "yn" => "1",
                            "payBargainReal" => "0",
                            "id" => "2341345",
                            "skuCount" => "1",
                            "payBalanceReal" => "0",
                            "balanceEndTime" => "2021-04-22 10:11:00",
                            "updateTime" => "2021-04-22 10:11:00",
                            "balanceStartTime" => "2021-04-22 10:11:00",
                            "balanceTime" => "2021-04-22 10:11:00",
                            "bargainTime" => "2021-04-22 10:11:00",
                            "payBalancePlan" => "0",
                            "userPin" => "jd_sdfwslsd23",
                            "balanceEndTimePlan" => "2021-04-22 10:11:00",
                            "createTime" => "2021-04-22 10:11:00",
                            "presaleId" => "34563",
                            "shopID" => "342324",
                            "skuID" => "233984"
                        ]
                    ],
                    "detail" => "详细信息"
                ],
            ],
        ];
    }

    // 增量查询服务单信息
    public function jingdong_asc_sync_list(Request $request)
    {
        $items = [
            "sysVersion" => "1",
            "orderType" => "22",
            "questionTypeCid2" => "1234",
//            "orderId" => date('YmdHis'),
            "orderId" => $this->orderId,
            "questionTypeCid1" => "123",
            "questionTypeCid1Name" => "原因1",
            "updateTime" => date('Y-m-d H:i:s'),
            "parentService" => "12345",
            "customerExpect" => "10",
            "freightUpdateDate" => date('Y-m-d H:i:s'),
            "customerName" => "testPin",
            "platformSrc" => "212",
            "serviceCount" => "1",
            "serviceStatus" => 10001, // 10001-待审核, 10005-待收货, 10011-取消, 10010-完成
            "pickwareType" => "4",
            "platformSrcName" => "商家端",
            "customerPin" => "testPin",
            "expressCode" => "JDVA123456",
            "questionTypeCid2Name" => "原因2",
            "serviceId" => date('YmdHis') . rand(0000, 9999),
            "applyTime" => date('Y-m-d H:i:s'),
            "customerMobile" => "12345",
            "open_id_buyer" => "testPin",
            "skuId" => "12345"
        ];

        return [
            'jingdong_asc_sync_list_responce' => [
                'pageResult' => [
                    "msg" => "业务异常",
                    "code" => "000000",
                    "pageNumber" => "1",
                    "data" => $this->requestParams['pageNumber'] > 1 ? [] : [$items],
                    "success" => "true",
                    "pageSize" => $this->requestParams['pageSize'] ?? 0,
                    "totalCount" => $this->requestParams['pageNumber'] > 1 ? 0 : count($items)
                ],
            ]
        ];
    }

    public function jingdong_asc_query_view(Request $request)
    {
        $items = [
            [
                "wareDescribe" => "测试商品描述",
                "skuUuid" => "1234456",
                "applyDetailId" => "1234567",
                "wareTypeName" => "主商品",
                "extJsonStr" => "{}",
                "applyDetailIdLong" => "3376835625",
                "wareName" => "测试商品名称",
                "skuType" => "1",
                "skuId" => "202405230001",
                "wareType" => "10",
                "skuTypeName" => "主品"
            ]
        ];

        $serviceBillDetails = [
            [
                "skuUuid" => "abc",
                "extJsonStr" => "{}",
                "wareNum" => 1,
                "wareName" => "测试商品名称",
                "skuType" => "1",
                "wareCid1" => "1",
                "wareCid2" => "2",
                "wareBrand" => "测试商品品牌",
                "wareDescribe" => "测试问题描述",
                "actualPayPrice" => "1.0",
                "wareCid3" => "3",
                "wareTypeName" => "主商品",
                "payPrice" => "1.0",
                "serviceDetailIdLong" => "3376835625",
                "serviceDetailId" => "1234456",
                "skuId" => "202405230001",
                "wareType" => "10",
                "skuTypeName" => "主品"
            ]
        ];

        return [
            'jingdong_asc_query_view_responce' => [
                'result' => [
                    "msg" => "失败",
                    "code" => "0",
                    "data" => [
                        "questionTypeCid2" => "1",
                        "orderType" => "0",
                        "orderId" => $this->requestParams['orderId'],
                        "questionTypeCid1" => "1",
                        "customerInfo" => [
                            "contactInfo" => [
                                "contactMobile" => "13300000011",
                                "contactName" => "testPin",
                                "contactZipcode" => "1222",
                                "contactTel" => "1234456678"
                            ],
                            "grade" => "90",
                            "extJsonStr" => "{}",
                            "name" => "testPin",
                            "open_id_buyer" => "testPin",
                            "jdPin" => "testPin"
                        ],
                        "appointment" => [
                            "appointDateEnd" => "2021-12-23 00:00:00",
                            "appointDateType" => "1",
                            "extJsonStr" => "{}",
                            "appointDateBegin" => "2021-12-23 00:00:00",
                            "reserveDate" => "2021-12-23 00:00:00",
                            "appointDateStr" => "a"
                        ],
                        "processPin" => "testPin",
                        "applyDetailList" => $items,
                        "applyId" => "123456",
                        "customerExpectName" => "换货",
                        "processName" => "testPin",
                        "orderShopId" => "123456",
                        "questionTypeCid2Name" => "测试问题类型2",
                        "approveName" => "testPin",
                        "applyTime" => intval(microtime(true) * 1000),
                        "skuTypeName" => "主商品",
                        "questionDesc" => "测试问题描述",
                        "wareChangeWithApplyDTO" => [
                            "changeWarePrice" => "1.0",
                            "changeWareSku" => "202405230002",
                            "changeWareName" => "测试商品名称"
                        ],
                        "questionTypeCid1Name" => "测试问题类型1",
                        "processResult" => "40",
                        "receiveDate" => "2021-12-23 00:00:00",
                        "customerExpect" => 20, // 10-退货；20-换货
                        "updateName" => "testPin",
                        "invoiceCode" => "1234567",
                        "needDetectionReport" => "true",
                        "companyId" => "6",
                        "returnWareAddress" => [
                            "countyCode" => "3",
                            "provinceCode" => "1",
                            "cityCode" => "2",
                            "extJsonStr" => "{}",
                            "detailAddress" => "测试详细地址",
                            "oaid" => $this->oaid,
                            "villageCode" => "4"
                        ],
                        "serviceCount" => "1",
                        "processResultName" => "退货",
                        "newOrderId" => "123456",
                        "processDate" => "2021-12-23 00:00:00",
                        "serviceIdList" => [],
                        "questionPic" => "测试问题图片路径",
                        "serviceBillDetailList" => $serviceBillDetails,
                        "serviceStatusName" => "申请环节",
                        "returnWareType" => "40",
                        "updateDate" => time(),
                        "hasPackage" => "true",
                        "approveDate" => "2021-12-23 00:00:00",
                        "hasInvoice" => "true",
                        "processNotes" => "测试处理已经",
                        "refundType" => "4",
                        "pickwareAddress" => [
                            "countyCode" => "3",
                            "provinceCode" => "1",
                            "cityCode" => "2",
                            "extJsonStr" => "{}",
                            "detailAddress" => "测试详细地址",
                            "oaid" => $this->oaid,
                            "villageCode" => "4"
                        ],
                        "approveResult" => "31",
                        "serviceStatus" => 10001, // 10001-待审核, 10005-待收货, 10011-取消, 10010-完成
                        "pickwareType" => "4",
                        "approveReasonCid2Name" => "测试审核原因",
                        "serviceId" => $this->requestParams['serviceId'],
                        "expectPickwareType" => "40",
                        "refundAmt" => "1.00",
                        "sysVersion" => "1",
                        "jdUpgradeSuggestion" => "测试升级意见",
                        "approveResultName" => "上门取件",
                        "approveNotes" => "测试审核意见",
                        "extJsonStr" => "{}",
                        "refundTypeName" => "原返",
                        "pickwareTypeName" => "上门取件",
                        "skuType" => "1",
                        "approvePin" => "北京分公司",
                        "orderTypeName" => "一般订单",
                        "expectPickwareTypeName" => "客户发货",
                        "approveReasonCid1Name" => "测试审核原因",
                        "returnWareTypeName" => "客户发货",
                        "approveReasonCid2" => "1",
                        "approveReasonCid1" => "1",
                        "afsContactInfo" => [
                            "contactMobile" => "13300000011",
                            "countyCode" => "3",
                            "contactName" => "testPin",
                            "provinceCode" => "1",
                            "cityCode" => "2",
                            "extJsonStr" => "{}",
                            "detailAddress" => "测试详细地址",
                            "contactZipcode" => "123456",
                            "contactTel" => "18800000011",
                            "villageCode" => "4"
                        ]
                    ],
                    "success" => "true"
                ],
            ],
        ];
    }

    public function jingdong_queryJdAreaIdList(Request $request)
    {
        $areaMapping = [
            '1' => '北京',
            '2' => '朝阳区',
            '3' => '双井地区',
            '4' => 'xxx街道',
        ];

        return [
            'jingdong_queryJdAreaIdList_responce' => [
                'baseRpcResponse' => [
                    "code" => "0000",
                    "data" => [
                        'areaInfoList' => [
                            [
                                "areaId" => $this->requestParams['jdAreaId'],
                                "areaName" => $areaMapping[$this->requestParams['areaLevel']]
                            ]
                        ],
                    ],
                    "success" => "true",
                    "message" => "success"
                ],
            ],
        ];
    }

    public function jingdong_vender_returnaddress_query(Request $request)
    {
        return [
            'jingdong_vender_returnaddress_query_responce' => [
                'returnAddressResult' => [
                    'return_address_s' => [
                        [
                            "full_area_id" => "1,23,2799",
                            "address_type" => 0,
                            "create_time" => "1394089643000",
                            "phone" => "13800000000",
                            "contact" => "张三",
                            "modify_time" => "1394089643000",
                            "id" => "123456",
                            "full_address" => "北京市朝阳区北辰西路8号",
                            "zip_code" => "100000"
                        ]
                    ],
                    "error_msg" => "",
                    "total_count" => 1,
                    "error_code" => "",
                    "is_success" => "true"
                ]
            ],
        ];
    }

    public function jingdong_asc_audit_reason_list(Request $request)
    {
        return [
            'jingdong_asc_audit_reason_list_responce' => [
                'result' => [
                    "msg" => "业务异常",
                    "code" => "000000",
                    "data" => [
                        [
                            "code" => "1234",
                            "parentCode" => "123",
                            "extJsonStr" => "a",
                            "name" => "测试审核原因名称"
                        ]
                    ],
                    "success" => "true"
                ],
            ]
        ];
    }

    public function jingdong_asc_audit_refuse(Request $request)
    {
        return [
            'jingdong_asc_audit_refuse_responce' => [
                'result' => [
                    "msg" => "业务异常",
                    "code" => "000000",
                    "data" => '成功',
                    "success" => "true"
                ]
            ],
        ];
    }

    public function v2_messages(Request $request)
    {
        $topic = $request->get('topic', 'topic');

        $data = [];
        if ($topic == 'order_order_create') {
            $data = [
                "object" => [
                    "venderId" => 777,
                    "orderId" => 63062022082120401,
                    "orderType" => 22,
                    "orderStatus" => "TRADE_CREATED",
                    "orderCreateTime" => "2022-08-21 09:00:10",
                    "orderPaymentType" => 4
                ]
            ];
        } elseif ($topic == 'order_order_cancel') {
            $data = [
                "object" => [
                    "venderId" => 777,
                    "orderId" => 63062022082120401,
                    "orderType" => 22,
                    "orderStatus" => "TRADE_CANCELED",
                    "orderCreateTime" => "2022-08-21 09:00:10",
                    "orderPaymentType" => 4
                ]
            ];
        } elseif ($topic == 'pop_appply_order_invoice_status') {
            $data = [
                "object" => [
                    "venderId" => 777,
                    "id" => "6306202208212040101",
                    "orderId" => 63062022082120401,
                    "invoiceStatus" => 1,
                    //"invoiceStatus" => 13,
                    "modified" => "2022-08-21 10:00:10"
                ]
            ];
        }
        $message = [
            'messageId' => Str::random(10),
            'messageBody' => json_encode($data)
        ];

        $messages = [];
        // 测试放开，不测注释
        //$messages[] = $message;
        $actIndex = sprintf("%s-%s", $topic, count($messages));

        return [
            'result' => [
                'topicName' => $topic,
                'ackIndex' => $actIndex,
                'messages' => $messages
            ]
        ];
    }

    public function v2_ack(Request $request)
    {
        return [
            'result' => []
        ];
    }

    public function jingdong_jos_oauth_rpc_xid_batchPin2Xid(Request $request)
    {
        $data = [];
        $userPins = explode(',', trim($this->requestParams['userPin']));
        foreach ($userPins as $pin) {
            $data[$pin] = Str::random(10);
        }

        return [
            'jingdong_jos_oauth_rpc_xid_batchPin2Xid_responce' => [
                'returnType' => [
                    "msg" => "success",
                    "code" => "0",
                    "data" => $data,
                    "requestId" => "abb084dfc7e84e0d9ada5f95e2"
                ]
            ]
        ];
    }

    public function jingdong_pop_order_ocs_query(Request $request)
    {
        $orderId = $this->requestParams['orderId'] ?? '';

        if ($orderId == '307930623822') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" =>
                                    "1012_SF1b1i2N1430583014433456128G10118421319410",
                                "orderId" => 307930623822,
                                "num" => 1,
                                "skuType" => 3,
                                "skuId" => 10118421319410,
                                "amountExpands" => [],
                            ],
                            [
                                "skuUuid" => "1012_F1b1i2N1430583014433456128",
                                "orderId" => 307930623822,
                                "num" => 1,
                                "skuType" => 2,
                                "skuId" => 10107156319011,
                                "amountExpands" => [
                                    [
                                        "amount" => 10,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 10,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "店铺东券",
                                        "type" => 4,
                                    ],
                                    [
                                        "amount" => 9.97,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 9.97,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "支付营销优惠类型",
                                        "type" => 126,
                                    ],
                                    [
                                        "amount" => 3870.03,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 3870.03,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "在线支付",
                                        "type" => 112,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3c0e9c3493b341dd81a8ca784919b47c",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '308200791746') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" => "1012_f3K2bJ1431939054555250688",
                                "orderId" => 308200791746,
                                "num" => 1,
                                "skuType" => 1,
                                "skuId" => 10132648627992,
                                "amountExpands" => [
                                    [
                                        "amount" => 0.46,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 0.46,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "超级红包支付",
                                        "type" => 151,
                                    ],
                                    [
                                        "amount" => 337.54,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 337.54,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "在线支付",
                                        "type" => 112,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3469031.50608.17358706847748939",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '301516990001') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" => "1012_F1Z2w3v1431945255722668032",
                                "orderId" => 301516990001,
                                "num" => 1,
                                "skuType" => 4,
                                "skuId" => 10113794430787,
                                "amountExpands" => [
                                    [
                                        "amount" => 15,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 15,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "店铺东券",
                                        "type" => 4,
                                    ],
                                    [
                                        "amount" => 5,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 5,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "东券",
                                        "type" => 2,
                                    ],
                                    [
                                        "amount" => 388,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 388,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "在线支付",
                                        "type" => 112,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3504038.50608.17358741302403439",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '308054185645') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" => "1012_f3G2y3P1431274126656417792",
                                "orderId" => 308054185645,
                                "num" => 2,
                                "skuType" => 1,
                                "skuId" => 10114212360582,
                                "amountExpands" => [
                                    [
                                        "amount" => 15,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 15,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "店铺东券",
                                        "type" => 4,
                                    ],
                                    [
                                        "amount" => 0.97,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 0.97,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "支付营销优惠类型",
                                        "type" => 126,
                                    ],
                                    [
                                        "amount" => 340.03,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 340.03,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "在线支付",
                                        "type" => 112,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3469035.50608.17358752207168055",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '301379554099') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" => "1012_F2h2N4B1430156687292293120",
                                "orderId" => 301379554099,
                                "num" => 1,
                                "skuType" => 4,
                                "skuId" => 10042478433804,
                                "amountExpands" => [
                                    [
                                        "amount" => 19.1,
                                        "typeName" => "跨境电商综合税（包税)",
                                        "type" => 437,
                                    ],
                                    [
                                        "amount" => 20,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 20,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "京享礼金",
                                        "type" => 215,
                                    ],
                                    [
                                        "amount" => 28.9,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 28.9,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "限品类东券",
                                        "type" => 6,
                                    ],
                                    [
                                        "amount" => 180.1,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 180.1,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "在线支付",
                                        "type" => 112,
                                    ],
                                    [
                                        "amount" => 310,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 310,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "单品优惠（B商城专享价）",
                                        "type" => 202,
                                    ],
                                    [
                                        "amount" => 60,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 60,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "满减",
                                        "type" => -200,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3469035.50608.17358937663594080",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '307592623404') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" => "1012_F2P1n1g1427765955412099072",
                                "orderId" => 307592623404,
                                "num" => 1,
                                "skuType" => 4,
                                "skuId" => 10096487599388,
                                "amountExpands" => [
                                    [
                                        "amount" => 2.95,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 2.95,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "Plus立减",
                                        "type" => 237,
                                    ],
                                    [
                                        "amount" => 10,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 10,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "店铺东券",
                                        "type" => 4,
                                    ],
                                    [
                                        "amount" => 1.5,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 1.5,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "支付营销优惠类型",
                                        "type" => 126,
                                    ],
                                    [
                                        "amount" => 498.55,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 498.55,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "在线支付",
                                        "type" => 112,
                                    ],
                                    [
                                        "amount" => 77,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 77,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "满减",
                                        "type" => -200,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3504038.50608.17369048192421123",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '301873876584') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" => "1012_F2h2M4Q1398595884040257536",
                                "orderId" => 301873876584,
                                "num" => 1,
                                "skuType" => 4,
                                "skuId" => 10051465397686,
                                "amountExpands" => [
                                    [
                                        "amount" => 0.6,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 0.6,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "店铺支付营销",
                                        "type" => 183,
                                    ],
                                    [
                                        "amount" => 0.4,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 0.4,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "支付营销优惠类型",
                                        "type" => 126,
                                    ],
                                    [
                                        "amount" => 64.45,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 64.45,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "在线支付",
                                        "type" => 112,
                                    ],
                                    [
                                        "amount" => 53.55,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 53.55,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "满减",
                                        "type" => -200,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3469031.50608.17369052764027197",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '308511194016') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" => "1012_F2A3VZ1412602111711404032",
                                "orderId" => 308511194016,
                                "num" => 5,
                                "skuType" => 4,
                                "skuId" => 10057625657313,
                                "amountExpands" => [
                                    [
                                        "amount" => 111.75,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 111.75,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "单品折扣",
                                        "type" => 245,
                                    ],
                                    [
                                        "amount" => 330,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 330,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "大促跨店满减",
                                        "type" => 221,
                                    ],
                                    [
                                        "amount" => 500,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 500,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "礼品卡",
                                        "type" => 101,
                                    ],
                                    [
                                        "amount" => 500,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 500,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "礼品卡",
                                        "type" => 101,
                                    ],
                                    [
                                        "amount" => 500,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 500,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "礼品卡",
                                        "type" => 101,
                                    ],
                                    [
                                        "amount" => 293.25,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 293.25,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "礼品卡",
                                        "type" => 101,
                                    ],
                                    [
                                        "amount" => 190,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 190,
                                                "bearer" => 2,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "单品优惠（B商城专享价）",
                                        "type" => 202,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3469031.50608.17369071753250045",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '297637977938') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "skuUuid" => "1012_F2t2t3F1400843350769369088",
                                "orderId" => 297637977938,
                                "num" => 1,
                                "skuType" => 1,
                                "skuId" => 10118256042973,
                                "amountExpands" => [
                                    [
                                        "amount" => 32.4,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 32.4,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "Plus立减",
                                        "type" => 237,
                                    ],
                                    [
                                        "amount" => 1068.6,
                                        "typeName" => "调价优惠",
                                        "type" => 236,
                                    ],
                                    [
                                        "amount" => 6999,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 6999,
                                                "bearer" => 1,
                                                "bearRate" => 1,
                                            ],
                                        ],
                                        "typeName" => "在线支付",
                                        "type" => 112,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    "request_id" => "3469031.50608.17369087838389451",
                    "code" => "0",
                ],
            ];
        } elseif ($orderId == '295091846947') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 295091846947,
                                "skuId" => 10045307466056,
                                "skuType" => 1,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 150,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 150, "bearer" => 2],
                                        ],
                                    ],
                                    [
                                        "typeName" => "Plus立减",
                                        "amount" => 4.9,
                                        "type" => 237,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 4.9, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "店铺限商品东劵类型",
                                        "amount" => 40,
                                        "type" => 9,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 40, "bearer" => 2],
                                        ],
                                    ],
                                    [
                                        "typeName" => "支付营销优惠类型",
                                        "amount" => 0.01,
                                        "type" => 126,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 0.01, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 785.09,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 785.09, "bearer" => 1],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_f3G4f2Z1349490676031995904",
                            ],
                        ]
                    ]
                ]
            ];
        } elseif ($orderId == '308831456977') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 308831456977,
                                "skuId" => 10043789869570,
                                "skuType" => 4,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 146.68,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 146.68,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "自营商家联合按比例承担优惠劵",
                                        "amount" => 19.6,
                                        "type" => 12,
                                    ],
                                    [
                                        "typeName" => "限品类东券",
                                        "amount" => 78.01,
                                        "type" => 6,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 78.01,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" =>
                                            "以旧换新补贴金额（京东/商家补贴,含旧机补贴和新机补贴）",
                                        "amount" => 20,
                                        "type" => 1009,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 20,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "支付营销优惠类型",
                                        "amount" => 0.02,
                                        "type" => 126,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 0.02,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 706.24,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 706.24,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 9.45,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 9.45,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" =>
                                            "自营商家联合按比例承担优惠劵（商家承担）",
                                        "amount" => 9.6,
                                        "type" => 14,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 9.6,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" =>
                                            "自营商家联合按比例承担优惠劵（自营承担）",
                                        "amount" => 10,
                                        "type" => 13,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 10,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2tQ4u1436803864564400128",
                            ],
                        ],
                    ],
                    "request_id" => "3503698.39587.17370432031635193",
                ],
            ];
        } elseif ($orderId == '308986956360') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 308986956360,
                                "skuId" => 10132816941900,
                                "skuType" => 3,
                                "amountExpands" => [],
                                "num" => 1,
                                "skuUuid" =>
                                    "1012_SF1Z2w4n1437116175972392960G10132816941900",
                            ],
                            [
                                "orderId" => 308986956360,
                                "skuId" => 29016910492,
                                "skuType" => 4,
                                "amountExpands" => [
                                    [
                                        "typeName" => "限品类东券",
                                        "amount" => 300,
                                        "type" => 6,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 300,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "自营商家联合按比例承担优惠劵",
                                        "amount" => 60,
                                        "type" => 12,
                                    ],
                                    [
                                        "typeName" => "超级红包支付",
                                        "amount" => 1,
                                        "type" => 151,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 1,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "超级红包支付",
                                        "amount" => 5,
                                        "type" => 151,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 5,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "支付营销优惠类型",
                                        "amount" => 2.38,
                                        "type" => 126,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 2.38,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 1121.62,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 1121.62,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" =>
                                            "自营商家联合按比例承担优惠劵（自营承担）",
                                        "amount" => 60,
                                        "type" => 13,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 60,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F1Z2w4n1437116175972392960",
                            ],
                        ],
                    ],
                    "request_id" => "3503681.39587.17371034425721404",
                ],
            ];
        } elseif ($orderId == '304532689816') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 304532689816,
                                "skuId" => 10095059394905,
                                "skuType" => 4,
                                "amountExpands" => [
                                    [
                                        "typeName" => "Plus立减",
                                        "amount" => 17.45,
                                        "type" => 237,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 17.45, "bearer" => 2],
                                        ],
                                    ],
                                    ["typeName" => "pop基础运费", "amount" => 2.88, "type" => 430],
                                    [
                                        "typeName" => "支付营销优惠类型",
                                        "amount" => 0.96,
                                        "type" => 126,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 0.96, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 333.47,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 333.47, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "单品优惠（B商城专享价）",
                                        "amount" => 50,
                                        "type" => 202,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 50, "bearer" => 2],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F1g3zM1431692071979773952",
                            ],
                        ],
                    ],
                ],
            ];
        } elseif ($orderId == '307953749806') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 307953749806,
                                "skuId" => 10117975870073,
                                "skuType" => 1,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 219.93,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 219.93, "bearer" => 2],
                                        ],
                                    ],
                                    [
                                        "typeName" => "店铺东券",
                                        "amount" => 30,
                                        "type" => 4,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 30, "bearer" => 2],
                                        ],
                                    ],
                                    [
                                        "typeName" => "超级红包支付",
                                        "amount" => 0.34,
                                        "type" => 151,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 0.34, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "超级红包支付",
                                        "amount" => 0.12,
                                        "type" => 151,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 0.12, "bearer" => 1],
                                        ],
                                    ],
                                    ["typeName" => "外部渠道实付", "amount" => 89.09, "type" => 1056],
                                    [
                                        "typeName" => "品牌购物卡-本金",
                                        "amount" => 712.71,
                                        "type" => 1054,
                                    ],
                                    [
                                        "typeName" => "品牌购物卡-权益金-pop商家承担",
                                        "amount" => 89.09,
                                        "type" => 1058,
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 326.72,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 326.72, "bearer" => 1],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F1g2WE1430690106788319232",
                            ],
                        ],
                    ],
                ],
            ];
        } elseif ($orderId == '291214440060') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 291214440060,
                                "skuId" => 10098720948538,
                                "skuType" => 2,
                                "amountExpands" => [
                                    [
                                        "typeName" => "Plus立减",
                                        "amount" => 18.45,
                                        "type" => 237,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 18.45, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "自营商家联合按比例承担优惠劵",
                                        "amount" => 369,
                                        "type" => 12,
                                    ],
                                    [
                                        "typeName" => "京豆",
                                        "amount" => 24.2,
                                        "type" => 123,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 24.2, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "支付营销优惠类型",
                                        "amount" => 5,
                                        "type" => 126,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 5, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 3273.35,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 3273.35, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "自营商家联合按比例承担优惠劵（商家承担）",
                                        "amount" => 332.1,
                                        "type" => 14,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 332.1, "bearer" => 2],
                                        ],
                                    ],
                                    [
                                        "typeName" => "自营商家联合按比例承担优惠劵（自营承担）",
                                        "amount" => 36.9,
                                        "type" => 13,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 36.9, "bearer" => 1],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2A2W4k1331288260723564544",
                            ],
                        ],
                    ],
                ],
            ];
        } elseif ($orderId == '292077428558') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 292077428558,
                                "skuId" => 10043500995914,
                                "skuType" => 1,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 240,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 240, "bearer" => 2],
                                        ],
                                    ],
                                    [
                                        "typeName" => "限品类东券",
                                        "amount" => 188.5,
                                        "type" => 6,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 188.5, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "超级膨胀金本金",
                                        "amount" => 1396.6,
                                        "type" => 1047,
                                    ],
                                    [
                                        "typeName" => "购物金-权益金（POP承担）",
                                        "amount" => 59.9,
                                        "type" => 181,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 59.9, "bearer" => 2],
                                        ],
                                    ],
                                    [
                                        "typeName" => "单品优惠（B商城专享价）",
                                        "amount" => 609,
                                        "type" => 202,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 609, "bearer" => 2],
                                        ],
                                    ],
                                ],
                                "num" => 29,
                                "skuUuid" => "1012_F1Z2w4J1335183643006050304",
                            ],
                        ],
                    ],
                ],
            ];
        } elseif ($orderId == '308199579587') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 308199579587,
                                "skuId" => 10092886333633,
                                "skuType" => 5,
                                "amountExpands" => [
                                    [
                                        "typeName" => "满赠促销赠品的discount",
                                        "amount" => 198,
                                        "type" => 239,
                                    ],
                                    [
                                        "typeName" => "满赠满返促销",
                                        "amount" => 198,
                                        "type" => 206,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 198, "bearer" => 2],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_P276813689841G10092886333633",
                            ],
                            [
                                "orderId" => 308199579587,
                                "skuId" => 10079944917567,
                                "skuType" => 2,
                                "amountExpands" => [
                                    [
                                        "typeName" => "支付营销优惠类型",
                                        "amount" => 0.02,
                                        "type" => 126,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 0.02, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 1798.98,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 1798.98, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "满减",
                                        "amount" => 1201,
                                        "type" => -200,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 1201, "bearer" => 2],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2C1x3X1420416271543386112",
                            ],
                        ],
                    ],
                ],
            ];
        } elseif ($orderId == '296483727835') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 296483727835,
                                "skuId" => 10056632103983,
                                "skuType" => 1,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促官方立减",
                                        "amount" => 260,
                                        "type" => 232,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 260, "bearer" => 2],
                                        ],
                                    ],
                                    [
                                        "typeName" => "Plus立减",
                                        "amount" => 10,
                                        "type" => 237,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 10, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "限品类东券",
                                        "amount" => 80,
                                        "type" => 6,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 80, "bearer" => 1],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 1650,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 1650, "bearer" => 1],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2SB2k1383031257673957376",
                            ],
                        ],
                    ],
                ],
            ];
        } elseif ($orderId == '310183776350') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 310183776350,
                                "skuId" => 10139267112598,
                                "skuType" => 5,
                                "amountExpands" => [
                                    [
                                        "typeName" => "满赠促销赠品的discount",
                                        "amount" => 1,
                                        "type" => 239,
                                    ],
                                    [
                                        "typeName" => "满赠满返促销",
                                        "amount" => 1,
                                        "type" => 206,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_P283985103658G10139267112598",
                            ],
                            [
                                "orderId" => 310183776350,
                                "skuId" => 10114059762478,
                                "skuType" => 2,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 52.88,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 52.88,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "余额",
                                        "amount" => 325.12,
                                        "type" => 110,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 325.12,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2t2t4u1451948934532554752",
                            ],
                            [
                                "orderId" => 310183776350,
                                "skuId" => 10114060682163,
                                "skuType" => 2,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 55.68,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 55.68,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "余额",
                                        "amount" => 342.32,
                                        "type" => 110,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 342.32,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F1g3e2V1451958320554143744",
                            ],
                            [
                                "orderId" => 310183776350,
                                "skuId" => 10114060682164,
                                "skuType" => 2,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 55.68,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 55.68,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "余额",
                                        "amount" => 342.32,
                                        "type" => 110,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 342.32,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2X4c2G1451958725457842176",
                            ],
                            [
                                "orderId" => 310183776350,
                                "skuId" => 10121965325098,
                                "skuType" => 2,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 105.76,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 105.76,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "余额",
                                        "amount" => 650.24,
                                        "type" => 110,
                                        "orderCostAmounts" => [
                                            [
                                                "bearRate" => 1,
                                                "bearAmount" => 650.24,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 2,
                                "skuUuid" => "1012_F2h1R1f1451958805862793216",
                            ],
                        ],
                    ],
                    "request_id" => "4132790.39587.17407325458025914",
                ],
            ];
        } elseif ($orderId == '312432662347') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 312432662347,
                                "skuId" => 10136241495932,
                                "skuType" => 1,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 30,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 30,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "微信先用后付",
                                        "amount" => 202,
                                        "type" => 1082,
                                    ],
                                    [
                                        "typeName" => "单品优惠（B商城专享价）",
                                        "amount" => 77,
                                        "type" => 202,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 77,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2X1K1z1463560802387722240",
                            ],
                        ],
                    ],
                    "request_id" => "864d3c1dfbcb401ba59264db4a220b80",
                ],
            ];
        } elseif ($orderId == '312635371205') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 312635371205,
                                "skuId" => 10127045288236,
                                "skuType" => 3,
                                "amountExpands" => [],
                                "num" => 1,
                                "skuUuid" =>
                                    "1012_SF2C4N4O1464991459829809152G10127045288236",
                            ],
                            [
                                "orderId" => 312635371205,
                                "skuId" => 70616153365,
                                "skuType" => 2,
                                "amountExpands" => [
                                    [
                                        "typeName" => "大促跨店满减",
                                        "amount" => 570,
                                        "type" => 221,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 570,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "Plus立减",
                                        "amount" => 38.1,
                                        "type" => 237,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 38.1,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "店铺限商品东劵类型 ",
                                        "amount" => 200,
                                        "type" => 9,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 200,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "自营商家联合按比例承担优惠劵",
                                        "amount" => 20,
                                        "type" => 12,
                                    ],
                                    [
                                        "typeName" => "支付营销优惠类型",
                                        "amount" => 0.9,
                                        "type" => 126,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 0.9,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "店铺支付营销",
                                        "amount" => 1.2,
                                        "type" => 183,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 1.2,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 2979.8,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 2979.8,
                                                "bearRate" => 1,
                                                "bearer" => 1,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" => "单品优惠（B商城专享价）",
                                        "amount" => 90,
                                        "type" => 202,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 90,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                    [
                                        "typeName" =>
                                            "自营商家联合按比例承担优惠劵（商家承担）",
                                        "amount" => 20,
                                        "type" => 14,
                                        "orderCostAmounts" => [
                                            [
                                                "bearAmount" => 20,
                                                "bearRate" => 1,
                                                "bearer" => 2,
                                            ],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2C4N4O1464991459829809152",
                            ],
                        ],
                    ],
                    "request_id" => "936cd5d6d26347adb63dc667051b7dc9",
                ]
            ];
        } elseif ($orderId == '313316430149') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "orderId" => 313316430149,
                                "skuId" => 10074967019822,
                                "skuType" => 1,
                                "amountExpands" => [
                                    [
                                        "typeName" => "国补京东支付",
                                        "amount" => 749.85,
                                        "type" => 1053,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 749.85, "bearer" => 5],
                                        ],
                                    ],
                                    [
                                        "typeName" => "在线支付",
                                        "amount" => 4249.15,
                                        "type" => 112,
                                        "orderCostAmounts" => [
                                            ["bearRate" => 1, "bearAmount" => 4249.15, "bearer" => 1],
                                        ],
                                    ],
                                ],
                                "num" => 1,
                                "skuUuid" => "1012_F2C4G4q1469651019103219712",
                            ],
                        ],
                    ],
                ],
            ];
        } elseif ($orderId == '313788411461') {
            return [
                "jingdong_pop_order_ocs_query_responce" => [
                    "code" => "0",
                    "result" => [
                        "code" => "SUCCESS",
                        "data" => [
                            [
                                "amountExpands" => [],
                                "moneyOfSuit" => 0,
                                "num" => 1,
                                "orderId" => 313788411461,
                                "skuId" => 10094717172608,
                                "skuType" => 3,
                                "skuUuid" => "1012_SF2C3i2w1472278223921238016G10094717172608",
                            ],
                            [
                                "amountExpands" => [
                                    [
                                        "amount" => 42.4,
                                        "orderCostAmounts" => [
                                            ["bearAmount" => 42.4, "bearRate" => 1, "bearer" => 2],
                                        ],
                                        "type" => 245,
                                        "typeName" => "单品折扣",
                                    ],
                                    [
                                        "amount" => 120,
                                        "orderCostAmounts" => [
                                            ["bearAmount" => 120, "bearRate" => 1, "bearer" => 2],
                                        ],
                                        "type" => 221,
                                        "typeName" => "大促跨店满减",
                                    ],
                                    [
                                        "amount" => 140.19,
                                        "orderCostAmounts" => [
                                            ["bearAmount" => 140.19, "bearRate" => 1, "bearer" => 1],
                                        ],
                                        "type" => 101,
                                        "typeName" => "礼品卡",
                                    ],
                                    [
                                        "amount" => 545.41,
                                        "orderCostAmounts" => [
                                            ["bearAmount" => 545.41, "bearRate" => 1, "bearer" => 1],
                                        ],
                                        "type" => 101,
                                        "typeName" => "礼品卡",
                                    ],
                                    [
                                        "amount" => 122,
                                        "orderCostAmounts" => [
                                            ["bearAmount" => 122, "bearRate" => 1, "bearer" => 2],
                                        ],
                                        "type" => 202,
                                        "typeName" => "单品优惠",
                                    ],
                                ],
                                "moneyOfSuit" => 0,
                                "num" => 2,
                                "orderId" => 313788411461,
                                "skuId" => 10057625657313,
                                "skuType" => 4,
                                "skuUuid" => "1012_F2C3i2w1472278223921238016",
                            ],
                        ],
                    ],
                ],
            ];
        }

        return [
            "code" => "100004",
            "errorMessage" => "优惠分摊数据查询为空",
            "errorSolution" => "请联系接口负责人",
        ];
    }

    public function jingdong_pop_cinvoice_apply_order(Request $request)
    {
        $orderId = $this->requestParams['orderId'] ?? '';

        if (in_array($orderId, ['63062022082120400', '63062022082120401'])) {
            return [
                "jingdong_pop_cinvoice_apply_order_responce" => [
                    "request_id" => "4774557.41661.17403869462120250",
                    "response" => [
                        "code" => "10000",
                        "data" => [
                            "sourceId" => 10020,
                            "consumerAddress" => "",
                            "orderId" => $orderId,
                            "venderId" => 777,
                            "ivcContentName" => "明细",
                            "applyId" => (int)sprintf("%s01", $orderId),
                            "orderCompleteTime" => "2025-01-24 15:00:10",
                            "shouldInvoiceAmount" => 200,
                            "invoiceTitleType" => 4,
                            "invoiceType" => 1,
                            "ivcContentType" => 1,
                            "applyTime" => "2025-01-24 15:10:00",
                            "invoiceStatus" => 1,
                            "invoiceTitle" => "个人",
                            "consumerBankName" => "",
                            "orderShouldInvoiceAmountDetailList" => [
                                [
                                    "detailType" => 1,
                                    "shouldInvoiceAmount" => 150,
                                    "productId" => "10101",
                                    "price" => 150,
                                    "num" => 1,
                                    "productName" => "测试商品A 颜色:红色",
                                ],
                                [
                                    "detailType" => 2,
                                    "shouldInvoiceAmount" => 50,
                                    "productId" => "10102",
                                    "price" => 50,
                                    "num" => 1,
                                    "productName" => "测试商品A 颜色:绿色",
                                ],
                            ],
                        ],
                        "success" => true,
                    ],
                    "code" => "0",
                ],
            ];
        }

        return [
            "code" => "20008",
            "errorMessage" => "未从订单中心查询到此订单",
            "errorSolution" => "检查订单号是否合规"
        ];
    }

    public function jingdong_pop_order_partial_outship(Request $request)
    {
//        return [
//            'error_response' => [
//                'code' => 19,
//                'zh_desc' => '无效access_token',
//                'en_desc' => 'Invalid access_token'
//            ]
//        ];
        $orderSns = $this->requestParams['request']['data']['outshipItem']['orderIds'] ?? [];
        $orderId = $orderSns[0] ?? '';
        $success = true;
        if ($success) {
            $successList = [$orderId];
            $failList = [];
        } else {
            $successList = [];
            $failList = [[
                'code' => '1000012',
                'orderId' => $orderId,
                'failReason' => 'sku:xxx 发货数量超过剩余发货数量，请刷新重试'
            ]];
        }
        return [
            "jingdong_pop_order_partial_outship_responce" => [
                'response' => [
                    "msg" => "成功",
                    "code" => "200",
                    "data" => [
                        'successList' => $successList,
                        'failList' => $failList
                    ]
                ]
            ],
        ];
    }

    public function jingdong_pop_order_shipment(Request $request)
    {
//        return [
//            'error_response' => [
//                'code' => 19,
//                'zh_desc' => '无效access_token',
//                'en_desc' => 'Invalid access_token'
//            ]
//        ];
        $success = true;
        return [
            'jingdong_pop_order_shipment_responce' => [
                'sopjosshipment_result' => [
                    "chineseErrCode" => $success ? "成功" : "失败",
                    "englishErrCode" => $success ? "success" : "fail",
                    "success" => $success,
                    "errorCode" => $success ? "0" : "99999999"
                ],
            ]
        ];
    }

    public function jingdong_pop_order_partialship_judge(Request $request)
    {
//        return [
//            'error_response' => [
//                'code' => 19,
//                'zh_desc' => '无效access_token',
//                'en_desc' => 'Invalid access_token'
//            ]
//        ];
        $orderSns = $this->requestParams['request']['data']['orderList'] ?? [];

        $supportPartialShipment = true;
        $item = [
            "orderId" => $orderSns[0],
            "supportPartialShipment" => $supportPartialShipment,
            "notSupportSendPay" => $supportPartialShipment ? "" : "33_6",
            "notSupportType" => $supportPartialShipment ? "" : "3",
            "notSupportMsg" => $supportPartialShipment ? "" : "订单类型不支持"
        ];

        return [
            'jingdong_pop_order_partialship_judge_responce' => [
                'response' => [
                    "msg" => "成功",
                    "code" => "200",
                    "data" => [
                        'partialShipmentItemList' => [
                            $item
                        ],
                    ]
                ],
            ],
        ];
    }

    public function jingdong_stock_write_updateSkuStock(Request $request)
    {
        return [
            "jingdong_stock_write_updateSkuStock_responce" => [
                'success' => true
            ]
        ];
    }
}
